{template 'common/header'}

<ul class="nav nav-tabs">
	<li {if $op == 'post' && empty($id)}class="active"{/if}><a href="{php echo $this->createWebUrl('custom', array('op' => 'post'))}">添加快捷回复</a></li>
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('custom', array('op' => 'display'))}">管理快捷回复</a></li>
    {if $op == 'post' && !empty($id)}<li class="active"><a href="#">
    编辑快捷回复
    </a></li>{/if}
</ul>

{if $op == 'post'}

<div class="main">

    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
        <div class="panel panel-default">
            <div class="panel-heading">快捷回复设置</div>
            <div class="panel-body">

				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9">
                        <input type="text" name="displayorder" class="form-control" value="{$custom['displayorder']}" />
                    </div>
				</div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">快捷回复内容</label>
                    <div class="col-sm-9">
                        <input type="text" name="raply" class="form-control" value="{$custom['raply']}" />
                    </div>
				</div>                
		</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
    </form>
</div>
{elseif $op == 'display'}

<div class="main">
    <div class="store">
        <form action="" method="post" onsubmit="return formcheck(this)">
			<div class="panel panel-default">
				<div class="panel-body table-responsive">
					<table class="table table-hover">
						<thead>
							<tr>
								<th style="width:30px;"></th>
								<th style="width:80px;">排序</th>
								<th>快捷回复内容</th>
								<th style="width:180px;">操作</th>
							</tr>
						</thead>
						<tbody>
			{loop $custom $row}
				<tr>
					<td>{if count($children[$row['id']]) > 0}<a href="javascript:;"><i class="fa fa-chevron-down"></i></a>{/if}</td>
					<td><input type="text" class="form-control" name="displayorder[{$row['id']}]" value="{$row['displayorder']}"></td>
					<td><div class="type-parent">{$row['raply']}&nbsp;&nbsp;</div></td>
					<td><a href="{php echo $this->createWebUrl('custom', array('op' => 'post', 'id' => $row['id']))}" class="btn btn-default"><i class="fa fa-edit"></i> 编辑</a>&nbsp;&nbsp;<a href="{php echo $this->createWebUrl('custom', array('op' => 'delete', 'id' => $row['id']))}" class="btn btn-default" onclick="return confirm('确认删除此快捷回复吗？');return false;"><i class="fa fa-remove"></i> 删除</a></td>
				</tr>
			{/loop}
			</tbody>
					</table>
				</div>
           </div>
		<div class="form-group col-sm-12">
						<a href="{php echo $this->createWebUrl('custom', array('op' => 'post'))}" class="btn btn-default btn-primary"><i class="fa fa-plus-circle"></i> 添加新快捷回复</a>
						<span class="pull-right"><input name="submit" type="submit" class="btn btn-primary" value="更新快捷回复排序"></span>
						<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
        </form>
    </div>
</div>
{/if}
{template 'common/footer'}